package com.lonewalker.sparrow.controller;

/**
 * @author: lonewalker
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lonewalker.sparrow.annotation.IgnoreResponseResult;
import com.lonewalker.sparrow.annotation.ResponseResult;
import com.lonewalker.sparrow.domain.ApiResult;
import com.lonewalker.sparrow.entity.UserInfo;
import com.lonewalker.sparrow.req.UserAddReq;
import com.lonewalker.sparrow.req.UserInfoQueryReq;
import com.lonewalker.sparrow.service.UserInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@ResponseResult
@RequestMapping("/userinfo")
@RestController
public class UserInfoController {

    @Resource
    private UserInfoService userInfoService;

    @PostMapping("/add")
    public Boolean addUser(@RequestBody UserAddReq requestParam){
        return userInfoService.addUser(requestParam);
    }

    @IgnoreResponseResult
    @GetMapping("/list")
    public List<UserInfo> listUserInfo(){
        return userInfoService.list();
    }


    @PostMapping("/page")
    public Page<UserInfo> pageUserInfo(@RequestBody UserInfoQueryReq requestParam){
        return userInfoService.pageUserInfo(requestParam);
    }
}
